package com.google.code.lightsomy.route;

import java.util.List;
import java.util.Map;

/**
 * Mapper to map url request with configured routes.
 * 
 * @author Viktoras Agejevas
 *
 */
public interface Mapper {

	/**
	 * Tries to match supplied url with configured routers.
	 * 
	 * @param url
	 * @return true if there is a match
	 */
	boolean match(String url);
	
	/**
	 * Parses the parameters of successfully matched url.
	 * 
	 * @param url
	 * @return map of parameters
	 */
	Map<String, String> parse(String url);
	
	/**
	 * Adds the route to this mapper.
	 * 
	 * @param route
	 * @return this mapper
	 */
	Mapper addRoute(Route route);
	
	/**
	 * Removes the route from this mapper.
	 * 
	 * @param route
	 * @return this mapper
	 */
	Mapper removeRoute(Route route);
	
	/**
	 * Adds the list of supplied routes.
	 * 
	 * @param routes
	 */
	void addAllRoutes(List<Route> routes);
	
	/**
	 * Gets the list of all routes configured for this mapper.
	 * 
	 * @return list of routes
	 */
	List<Route> getRoutes();
	
}
